#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_comboBox_currentIndexChanged(int index)
{
    if (index < 0) return;
    if (ui->plainTextEdit->isReadOnly()) return;
    qDebug()<<ui->comboBox->currentText();
    // ui->plainTextEdit->setPlainText(ui->comboBox->currentText() + QString::number(index));
    ui->plainTextEdit->appendPlainText(ui->comboBox->currentText() + " " + QString::number(index));
}

void Widget::on_initCombox_clicked()
{
    QIcon icon;
    icon.addFile(":/icon/icons/UNIT.ICO");
    ui->comboBox->addItem(icon, "张三");
    ui->comboBox->addItem(icon, "李四");
}

void Widget::on_clearCombox_clicked()
{
    ui->comboBox->clear();
}

void Widget::on_pushButton_5_clicked()
{
    ui->plainTextEdit->clear();
}

void Widget::on_checkBox_2_clicked(bool checked)
{
    ui->plainTextEdit->setReadOnly(checked);
}

